<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<script src="../vue.js"></script>

<body>
  <div id="app">
    {{msg}}
  </div>

  <script>
    const vm = new Vue({
      el: "#app",
      data: {
        msg: "zhangsan"
      },
      beforeCreate() {
        console.log("实例创建之前");
        // 在实例传记之前无法获取data里面的数据
        console.log(this.$data.msg);
      },
      created() {
        console.log("实例创建之后");
        // 在实例传记之后可以获取data里面的数据
        console.log(this.$data.msg);
      },
      methods: {},
    })
  </script>
</body>

</html>